package net.lab1024.sa.admin.module.business.supercomputer.sqlgenerator.constant;

import net.lab1024.sa.base.common.enumeration.BaseEnum;

public class SQLTypeToFlinkTypeConstants {

    // SQL 数据类型与 Flink 数据类型的映射
    public static final String SQL_INT = "INT";           // Integer
    public static final String SQL_BIGINT = "BIGINT";     // Long
    public static final String SQL_VARCHAR = "VARCHAR";   // String
    public static final String SQL_TEXT = "TEXT";         // String
    public static final String SQL_BOOLEAN = "BOOLEAN";    // Boolean
    public static final String SQL_DATE = "DATETIME";         // java.sql.Date
    public static final String SQL_TIMESTAMP = "TIMESTAMP"; // java.sql.Timestamp
    public static final String SQL_FLOAT = "FLOAT";       // Float
    public static final String SQL_DOUBLE = "DOUBLE";     // Double
    public static final String SQL_DECIMAL = "DECIMAL";   // BigDecimal

    // 方法: 将 SQL 字段类型转换为 Flink 变量类型
    public static String sqlToFlinkType(String sqlType) {
        switch (sqlType.toUpperCase()) {
            case SQL_INT:
                return "String";
            case SQL_BIGINT:
                return "String";
            case SQL_VARCHAR:
            case SQL_TEXT:
                return "String";
            case SQL_BOOLEAN:
                return "String";
            case SQL_DATE:
                return "String";
            case SQL_TIMESTAMP:
                return "String";
            case SQL_FLOAT:
                return "String";
            case SQL_DOUBLE:
                return "String";
            case SQL_DECIMAL:
                return "String";
            default:
                throw new IllegalArgumentException("Unsupported SQL type: " + sqlType);
        }
    }
}